<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div class="layui-container">
    <div class="layui-row">
        <button class="layui-btn layui-col-md1" id="back" ><i class="layui-icon">&#xe65c;</i>返回</button>
    </div>


    <hr/>

    <form class="layui-form ">
        <input type="hidden" name="id" th:value="${goodsTypeBig==null? null:goodsTypeBig.id}">
        <div class="layui-form-item">
            <label class="layui-form-label">标题类型名</label>
            <div class="layui-input-inline">
                <input type="text" name="name" lay-verify="required" placeholder="标题类型名称"
                       class="layui-input" th:value="${goodsTypeBig==null? null:goodsTypeBig.name}">
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">标题描述</label>
            <div class="layui-input-block">
                <textarea name="mark" placeholder="请输入内容" class="layui-textarea" th:text="${goodsTypeBig==null? null:goodsTypeBig.mark}"></textarea>
            </div>
        </div>


        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>


</div>
<script type="text/javascript">
    layui.use(['form', 'layer'], function () {
        var form = layui.form;
        $ = layui.jquery;
        layer = layui.layer;
        form.render(); //更新全部


        /*****************************
         * @Description: 表单提交
         * @Param:
         * @return:
         * @Author: 刘涛
         * @Date: 2018/3/14
         *******************************/
        form.on('submit(*)', function (data) {
            $.ajax({
                url: "/type/bigAddOrEdit",
                dataType: "json",
                data: data.field,
                type: "post",
                success: function (data) {
                    if (data.code == 200) {
                        layer.msg(data.msg+',页面稍后跳转', {icon: 1, anim: 1});
                        setTimeout('$("#content-body").load("/type/goTypemgr")',3000);
                    } else {
                        layer.msg(data.msg, {icon: 2, anim: 6});
                    }
                }
            })

            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });

        /**
         * 返回按钮
         * */
        $("#back").click(function () {
            $("#content-body").load("type/goTypemgr");
        })

    });
</script>
</body>
</html>